//
//  POSSureViewController.m
//  NewPro
//
//  Created by 何荧红 on 2018/10/10.
//  Copyright © 2018 何荧红. All rights reserved.
//

#import "POSSureViewController.h"
#import "PosRegistViewController.h"
#import "TraditionPOSVC.h"

@interface POSSureViewController ()

@end

@implementation POSSureViewController
//- (void)viewWillAppear:(BOOL)animated{
//    [super viewWillAppear:YES];
//    self.navigationController.navigationBar.hidden = YES;
//}
//- (void)viewWillDisappear:(BOOL)animated{
//    [super viewWillDisappear:YES];
//    self.navigationController.navigationBar.hidden = NO;
//}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self initCSS];
}
- (void)initCSS{
    self.view.backgroundColor = [UIColor colorWithHexString:@"F4F4F4"];
    NSString *str = @"";
    if (self.StatusType == 0) {
        str = @"资料提交";
    }else if (self.StatusType == 1){
        str = @"认证成功";
    }
    
    [self setNavBarWithTitle:str];
    
    UIImageView *status = [[UIImageView alloc]init];
    status.image = [UIImage imageNamed:@"实名识别成功"];
    [self.view addSubview:status];
    [status mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(70);
        make.width.mas_equalTo(70);
        make.top.equalTo(self.view).offset(99);
        make.centerX.equalTo(self.view.mas_centerX);
    }];
    
    if (self.StatusType == 0) {
        UILabel *sub = [[UILabel alloc]init];
        sub.textColor = [UIColor colorWithHexString:@"333333"];
        sub.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
        sub.text = @"资料提交成功等待系统审核";
        [self.view addSubview:sub];
        [sub mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(status.mas_centerX);
            make.top.equalTo(status.mas_bottom).offset(15);
        }];
        UILabel *subsub = [[UILabel alloc]init];
        subsub.textColor = [UIColor colorWithHexString:@"999999"];
        subsub.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        subsub.text = @"（1-2个工作日审核完成）";
        [self.view addSubview:subsub];
        [subsub mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(status.mas_centerX);
            make.top.equalTo(sub.mas_bottom).offset(2);
        }];
        UIButton *sure = [[UIButton alloc]init];
        sure.layer.masksToBounds = YES;
        sure.layer.cornerRadius = 6;
        sure.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        [sure setTitle:@"确认" forState:UIControlStateNormal];
        sure.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:18];
        [sure setTitleColor:[UIColor colorWithHexString:@"ffffff"] forState:UIControlStateNormal];
        [sure addTarget:self action:@selector(toSureOrNext) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:sure];
        [sure mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(49);
            make.width.mas_equalTo(SCREEN_WIDTH - 48);
            make.centerX.equalTo(self.view.mas_centerX);
            make.top.equalTo(subsub.mas_bottom).offset(140);
        }];
    }else{
        UILabel *sub = [[UILabel alloc]init];
        sub.textColor = [UIColor colorWithHexString:@"333333"];
        sub.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
        sub.text = @"实名认证成功！";
        [self.view addSubview:sub];
        [sub mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(status.mas_centerX);
            make.top.equalTo(status.mas_bottom).offset(15);
        }];
        
        UIButton *Invitation = [[UIButton alloc]init];
        Invitation.layer.masksToBounds = YES;
        Invitation.layer.cornerRadius = 6;
        Invitation.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        [Invitation setTitle:@"邀请合伙人" forState:UIControlStateNormal];
        Invitation.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:18];
        [Invitation setTitleColor:[UIColor colorWithHexString:@"ffffff"] forState:UIControlStateNormal];
        [Invitation addTarget:self action:@selector(Invitationbutton) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:Invitation];
        [Invitation mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(49);
            make.width.mas_equalTo(SCREEN_WIDTH - 48);
            make.centerX.equalTo(self.view.mas_centerX);
            make.top.equalTo(sub.mas_bottom).offset(162);
        }];
        
        UIButton *sure = [[UIButton alloc]init];
        sure.layer.masksToBounds = YES;
        sure.layer.cornerRadius = 6;
        sure.backgroundColor = [UIColor colorWithHexString:@"CCCCCC"];
        [sure setTitle:@"返回首页" forState:UIControlStateNormal];
        sure.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:18];
        [sure setTitleColor:[UIColor colorWithHexString:@"FFFFFF"] forState:UIControlStateNormal];
        [sure addTarget:self action:@selector(toSureOrNext) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:sure];
        [sure mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(49);
            make.width.mas_equalTo(SCREEN_WIDTH - 48);
            make.centerX.equalTo(self.view.mas_centerX);
            make.top.equalTo(Invitation.mas_bottom).offset(25);
        }];
    }
}
- (void)Invitationbutton{
    
}
- (void)toSureOrNext{
    UIViewController *subview = [[AppDelegate sharedAppDelegate].navigationViewController.viewControllers objectAtIndex:[AppDelegate sharedAppDelegate].navigationViewController.viewControllers.count - 3];
    if ([subview isKindOfClass:[PosRegistViewController class]]) {
        
        PosRegistViewController *VC = (PosRegistViewController *)subview;
        [[AppDelegate sharedAppDelegate] popToViewController:VC];
        
    }else if ([subview isKindOfClass:[TraditionPOSVC class]]){
        
        TraditionPOSVC *VC = (TraditionPOSVC *)subview;
        [[AppDelegate sharedAppDelegate] popToViewController:VC];
    }
}

@end
